package com.dmz.auth.granter;

import java.util.Collection;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

public class PhoneAndPasswordAuthenticationToken extends AbstractAuthenticationToken{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Object principal;
	private Object credentials;
	
	public PhoneAndPasswordAuthenticationToken(Object phone,Object password) {
		super(null);
		this.principal=phone;
		this.credentials=password;
		 //设置没有认证
        setAuthenticated(false);
	}
	
	public PhoneAndPasswordAuthenticationToken(Object phone,Object password,Collection<? extends GrantedAuthority> authorities) {
		
		super(authorities);
		this.principal=phone;
		this.credentials=password;
		//设置已经认证
        super.setAuthenticated(true);
	}


	@Override
	public Object getCredentials() {
		return credentials;
	}

	@Override
	public Object getPrincipal() {
		return principal;
	}

}
